<?php
require_once('App-Top.php');
require_once('Cookie-Handler.php'); //// Only Activate in UNProtected Area
////require_once('Authorizer.php'); //// Only Activate in Protected Area
require_once('FEFunctions.php');
//// EventDetail.php
//// This is the Event Detail page for the WOG site.

//// Set Page Title
$page_title = 'Event Detail - Whiff Of Grape';

if (!isset($_GET['eventID'])) {
    header("Location: EventsSearch.php");
    exit();
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title><?php echo $page_title; ?></title>
        <style type="text/css" media="screen">@import url(style.css);</style>
    </head>

<body>
    <div id="bigWrapper">

        <div id="wrapper">

            <div id="header">
            </div>

            <div id="sidebar">

                <?php
                    require_once('MenuLeft.php');
                ?>

            </div>

            <!-- End of Header & Start Content -->

            <div id="body">

                <div id="entryTitlePage"><?php echo $page_title; ?></div>

                <?php
                require_once(MYSQL);
                require_once(STATEM_MYSQL);
                require_once('FEFunctions.php');
                require_once('ShowEventsFunctions.php');


                $eventIdClean = clean(heal($_GET['eventID']),$dbc);

                //// Query for the Upcoming/Blocked Event
                $qEventDetail = sprintf($Q_ALL_Eventid_EventDetail, $eventIdClean);
                $rEventDetail = mysqli_query($dbc, $qEventDetail) or trigger_error("Query: $qEventDetail\n<br />MySQL Error: " . mysqli_error($dbc));

                $numRowsEventDetail = mysqli_num_rows($rEventDetail);

                if ($numRowsEventDetail >= 1)
                {
                    // Contains the information of each Event
                    $arrayEventDetail;
                    $indexRows = 0;
                    while ($indexRows < $numRowsEventDetail)
                    {
                        $arrayEventDetail[] = mysqli_fetch_array ($rEventDetail, MYSQLI_ASSOC);
                        $indexRows++;
                    }

                    // Printing each Detail Event
                    $indexRows = 0;
                    foreach ($arrayEventDetail as $rowEventDetail)
                    {

                        // Display the event formatted
                        showIndexEvents($rowEventDetail, NULL, 'D' );

                        $indexRows++;
                        if ($numRowsEventDetail > $indexRows)
                        {
                            echo '<div class="timingEventsLineInner"></div>';
                        }
                    }

                }
                else
                {
                    //// Events set as Upcoming/Blocked.
                    echo '<p class="entrybodybold">There is no Event associated with: ' . $eventIdClean . '</p>';
                    echo '<p class="entrybodybold">Click <a href="EventsSearch.php" title="EventSearch">here</a> to search for available Events</p>';
                }

                mysqli_free_result($rEventDetail);

                mysqli_close($dbc);

                ?>

            </div> <!-- Closes body -->

            <!-- End of Content & Start Footer -->

            <div id="footer">

                <?php
                //// Includer Footer
                include ('footer.php');
                ?>

            </div>

        </div> <!-- Closes Wrapper -->
    </div> <!-- Closes bigWrapper -->
</body>
</html>
<?php
require_once('App-End.php');
?>

<!-- Designed & Developed By Jose Trujillo (2011) -->